begin tran

create table #temp_style_no (org_style_no nchar(15), new_style_no nchar(15))
insert into #temp_style_no
select 'KSHKY9DN5016RF          ', 'KSFKY9DN5016RF      '  


declare @upd_id int
select @upd_id = convert(int, var_data) from igs_parm with(updlock) where var_name = 'gv_upd_id'

alter table dc_event_style disable trigger all
alter table dc_order_dtl disable trigger all
alter table dc_preorder_dtl disable trigger all
alter table fg_stk_style disable trigger all
alter table fg_stkform_style disable trigger all
alter table fn_event_style disable trigger all
alter table fn_event_style_shop disable trigger all
alter table fn_style_grp_dtl disable trigger all
alter table ms_style disable trigger all
alter table ms_style_color_price disable trigger all
alter table ms_style_fit disable trigger all
alter table ms_style_lang disable trigger all
alter table ms_style_price disable trigger all
alter table ms_style_prop disable trigger all
alter table ms_style_size disable trigger all
alter table ms_style_sizespec_val disable trigger all
alter table pos_pm_style_grp disable trigger all
alter table pos_sku disable trigger all
alter table pos_style_rack disable trigger all
alter table pur_dtl disable trigger all

update dc_event_style set style_no = a.new_style_no from #temp_style_no a where dc_event_style.style_no = a.org_style_no
update dc_order_dtl set style_no = a.new_style_no from #temp_style_no a where dc_order_dtl.style_no = a.org_style_no
update dc_preorder_dtl set style_no = a.new_style_no from #temp_style_no a where dc_preorder_dtl.style_no = a.org_style_no
update fg_stk_style set style_no = a.new_style_no from #temp_style_no a where fg_stk_style.style_no = a.org_style_no
update fg_stkform_style set style_no = a.new_style_no from #temp_style_no a where fg_stkform_style.style_no = a.org_style_no
update fn_event_style set style_no = a.new_style_no from #temp_style_no a where fn_event_style.style_no = a.org_style_no
update fn_event_style_shop set style_no = a.new_style_no from #temp_style_no a where fn_event_style_shop.style_no = a.org_style_no
update fn_style_grp_dtl set style_no = a.new_style_no from #temp_style_no a where fn_style_grp_dtl.style_no = a.org_style_no
update ms_style set style_no = a.new_style_no, upd_id = @upd_id from #temp_style_no a where ms_style.style_no = a.org_style_no
update ms_style_color_price set style_no = a.new_style_no from #temp_style_no a where ms_style_color_price.style_no = a.org_style_no
update ms_style_fit set style_no = a.new_style_no from #temp_style_no a where ms_style_fit.style_no = a.org_style_no
update ms_style_lang set style_no = a.new_style_no, upd_id = @upd_id from #temp_style_no a where ms_style_lang.style_no = a.org_style_no
update ms_style_price set style_no = a.new_style_no, upd_id = @upd_id from #temp_style_no a where ms_style_price.style_no = a.org_style_no
update ms_style_prop set style_no = a.new_style_no from #temp_style_no a where ms_style_prop.style_no = a.org_style_no
update ms_style_size set style_no = a.new_style_no from #temp_style_no a where ms_style_size.style_no = a.org_style_no
update ms_style_sizespec_val set style_no = a.new_style_no from #temp_style_no a where ms_style_sizespec_val.style_no = a.org_style_no
update pos_pm_style_grp set style_no = a.new_style_no from #temp_style_no a where pos_pm_style_grp.style_no = a.org_style_no
update pos_sku set style_no = a.new_style_no, upd_id = @upd_id from #temp_style_no a where pos_sku.style_no = a.org_style_no
update pur_dtl set style_no = a.new_style_no from #temp_style_no a where pur_dtl.style_no = a.org_style_no
update reportserver.dbo.avenue_order_style set style_no = a.new_style_no from #temp_style_no a where reportserver.dbo.avenue_order_style.style_no = a.org_style_no
update reportserver.dbo.avenue_pur_style set style_no = a.new_style_no from #temp_style_no a where reportserver.dbo.avenue_pur_style.style_no = a.org_style_no

alter table dc_event_style enable trigger all
alter table dc_order_dtl enable trigger all
alter table dc_preorder_dtl enable trigger all
alter table fg_stk_style enable trigger all
alter table fg_stkform_style enable trigger all
alter table fn_event_style enable trigger all
alter table fn_event_style_shop enable trigger all
alter table fn_style_grp_dtl enable trigger all
alter table ms_style enable trigger all
alter table ms_style_color_price enable trigger all
alter table ms_style_fit enable trigger all
alter table ms_style_lang enable trigger all
alter table ms_style_price enable trigger all
alter table ms_style_prop enable trigger all
alter table ms_style_size enable trigger all
alter table ms_style_sizespec_val enable trigger all
alter table pos_pm_style_grp enable trigger all
alter table pos_sku enable trigger all
alter table pos_style_rack enable trigger all
alter table pur_dtl enable trigger all
drop table #temp_style_no
COMMIT  tran